/**
 * 配置参数
 * @Author TAO 1755885716@qq.com
 * @Date 2023/9/20
 */
// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
// #endif

// #ifdef VUE3
import { createStore } from 'vuex'
const store = createStore({
// #endif
	state() {
		let token = uni.getStorageSync('token')||''
		let user = uni.getStorageSync('user')||{}
		let RegionList = uni.getStorageSync('RegionList')||{}
		let globalVariable = uni.getStorageSync('globalVariable')||{}
		return {
			token,//登录标识
			user,//用户的所有登陆信息
			RegionList,//区域
			globalVariable,
			rootUrls:'https://yunlzz.com.cn/'
			
		}
	},
	getters: {

	},
	mutations: {
		// 保存基础字段信息
		saveData(state,params){
			state[params.field]=params.value
			if(params.keep) uni.setStorageSync(params.field,params.value)
		},
	},
	actions: {
		// 保存基础字段信息
		saveData(store,params){
			store.commit('saveData',params);
		},
	}
})

export default store
